import {Injectable} from '@nestjs/common';
import {CreateRemarkDto} from './dto/create-remark.dto';
import {PrismaService} from "../prisma/prisma.service";

@Injectable()
export class RemarkService {
    constructor(private prisma: PrismaService) {
    }

    create(createRemarkDto: CreateRemarkDto) {
        return this.prisma.remark.create({
            data: createRemarkDto,
            include: {
                company: true
            }
        })
    }

    findAll() {
        return this.prisma.remark.findMany({include: {company: true}});
    }

    findOne(id: string) {
        return this.prisma.remark.findUnique({
            where: {id},
            include: {company: true}
        });
    }

    update(id: string, mark: number) {
        return this.prisma.remark.update({
            where: {id},
            data: {mark: mark},
            include: {
                company: true
            }
        });
    }

    remove(id: string) {
        return this.prisma.remark.delete({
            where: {id},
            include: {company: true}
        });
    }
}
